package com.itheima;

public class TestLambda {
    public static void main(String[] args) {
        testD();
    }



    //D
    public static void testD() {
        D c1 = new D() {
            @Override
            public int max(int a, int b) {
                return Math.max(a, b);
            }
        };
        D d2 =(a, b)->a > b ? a : b;
        D d3 = Math::max;
        int max = d3.max(6,9);
        System.out.println(max);
    }



    //C
    public static void testC() {
        C c1 = new C() {
            @Override
            public String show(String name) {
                return "name = "+ name;
            }
        };


        C c2 =name -> "name = "+ name;

        C c3 =TestLambda::show4;

    }

    public static String show4(String name){
        return "name = "+ name;
    }


    //B
    public static void testB() {
        B b1 = new B() {
            @Override
            public void show(String name) {
                System.out.println(name);
            }
        };

        B b2 = name -> System.out.println(name);

        B b3 = System.out::println;
        b3.show("李明同学");
    }



    //A
    public static void testA() {
        A a1 = new A() {
            @Override
            public void show(String name, int age) {
                System.out.println(name + "," + age);
            }
        };

        A a2 = (name, age) -> System.out.println(name + "," + age);
        a2.show("王二", 17);


        A a3 = TestLambda::show2;
        a3.show("王六", 23);

        TestLambda testLambda = new TestLambda();

        A a4 = TestLambda::show3;
        a3.show("王七", 23);

    }

    public static void show2(String name, int age){
        System.out.println("show2:"+name + "," + age);
    }

    public static void show3(String name, int age){
        System.out.println("show2:"+name + "," + age);
    }
}
